package com.hq.ims.userpc.controller;

import com.hq.ims.data.utils.LocalConstant;
import com.hq.ims.data.vo.BusInfoTrackMapstruct;
import com.hq.ims.data.vo.BusiInfoMapstruct;
import com.hq.ims.data.vo.pic.BusiInfoTraceCompanyTreeVo;
import com.hq.ims.userpc.busservice.UserBusiInfoMapService;
import com.hq.mybatis.base.page.RequestPage;
import com.hq.mybatis.base.page.ReturnPage;
import com.hq.utils.vo.ReturnVo;
import com.hq.web.annotations.GetJsonValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author cx
 * @date 2024/11/26 11:21:02
 * @description 项目经营一张图Controller
 */
@Api(tags = "项目经营一张图")
@RestController
@RequestMapping(LocalConstant.SYS_TYPE_USER_PC_URL_PREFIX + "/busiInfoMap")
public class UserBusiInfoMapController {

    @Resource
    private UserBusiInfoMapService userBusiInfoMapService;

    @ApiOperation(value = "我发布的经营信息查询-按项目查询", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/getBusiInfoPage", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<ReturnPage<BusiInfoMapstruct.BusiInfoVo>> getBusiInfoList(
            @RequestBody RequestPage<BusiInfoMapstruct.BusiInfoVo> page,
            @RequestBody BusiInfoMapstruct.PageSearchVo searchVo) {
        return userBusiInfoMapService.getBusiInfoPage(page, searchVo);
    }

    @ApiOperation(value = "查询经营信息跟踪数量-按公司查询", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "getBusInfoTraceCountByCompany", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<BusiInfoTraceCompanyTreeVo> getBusInfoTraceCountByCompany(@GetJsonValue(zh = "公司名称", required = false) String companyName) {
        return userBusiInfoMapService.getBusInfoTraceCountByCompany(companyName);
    }

    @ApiOperation(value = "经营信息跟踪查询-按公司查询", consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({})
    @PostMapping(value = "/getBusiInfoTrackByPage", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ReturnVo<ReturnPage<BusInfoTrackMapstruct.BusInfoTrackVo>> getByPage(
            @RequestBody RequestPage<BusInfoTrackMapstruct.BusInfoTrackVo> page,
            @GetJsonValue(zh = "公司ID") String companyId) {
        return userBusiInfoMapService.getBusiInfoTrackByPage(page, companyId);
    }
}
